# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo05
# Description:
# Author:       98745
# Date:         2019/3/17
#-------------------------------------------------------------------------------

from bs4 import BeautifulSoup
html='''
<html>
    <head><title>html5lib测试</title></head>
    <body>
        <a href='a.html'>first page</a>
        <p>
        <a href='a.html'>second page</a>
        <p>
        <a href='a.html'>third page</a>
        <p>
        <x k='123'>hello</x>
    </body>
</html>
'''
soup=BeautifulSoup(html,'lxml')
print(soup.a)
print(soup.body.a)
print(soup.a.name)
print(soup.a.text)
print(soup.a.string)
soup.a.name='div'
print(soup.div)

print(soup.x)
print('----------')
print(soup.x.string)
soup.x.string = 'world'
print(soup.x)
print(soup.body.text)